<template>
  <div class="Word">
    <div>Count=<input id="Text1" type="text" value="0">
	</div>
    <div style="height: 900px; width: auto" v-html="poHtmlCode">
     </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "Word",
  data() {
    return {
      poHtmlCode: "",
      count: 0,
    };
  },
  created: function () {
    //由于vue中的axios拦截器给请求加token都得是ajax请求，所以这里必须是axios方式去请求后台打开文件的controller
    axios
      .post("/api/HtmlDialog/Word")
      .then((response) => {
        this.poHtmlCode = response.data;
      })
      .catch(function (err) {
        console.log(err);
      });
  },
  methods: {
    updateCount(value) {
      this.count = this.count + value;
      document.getElementById("Text1").value = this.count;
      return this.count.toString();
    },
    ShowModalDlg() {
      pageofficectrl.ShowHtmlModalDialog(
        "../HtmlDialog/Modal",
        "abcdefg",
        "left=300px;top=390px;width=560px;height=410px;"
      )
    },
    ShowModelessDlg() {
      pageofficectrl.ShowHtmlModelessDialog(
        "../HtmlDialog/Modeless",
        "123456",
        "left=300px;top=390px;width=560px;height=410px;"
      )
    },
    OnPageOfficeCtrlInit() {
      pageofficectrl.AddCustomToolButton("弹出模态窗口", "ShowModalDlg()", 0);
      pageofficectrl.AddCustomToolButton("弹出非模态窗口","ShowModelessDlg()",0);
    }
  },
  mounted: function () {
    // 以下的为PageOffice事件的回调函数，名称不能改，否则PageOffice控件调用不到
    window.OnPageOfficeCtrlInit = this.OnPageOfficeCtrlInit;
    window.ShowModalDlg = this.ShowModalDlg;
    window.ShowModelessDlg = this.ShowModelessDlg;
	  window.updateCount=this.updateCount;
  }
}
</script>

